<template>
  <!-- 路由导航 -->
  <el-menu
    router
    unique-opened
    :default-active="computedPath"
    background-color="#2b4351"
    text-color="#fff"
    active-text-color="#00A4FF"
  >
<div v-for="(item,index) in menuList" :key="index">
<el-menu-item v-if="item.meta.level==1" :index="item.path">
      <i :class="['iconfont',item.meta.icon]"></i>
      <span slot="title">{{item.meta.title}}</span>
    </el-menu-item>

 <el-submenu  v-if="item.meta.level==2" :index="item.path">
      <template slot="title">
       <i :class="['iconfont',item.meta.icon]"></i>
        <span>{{item.meta.title}}</span>
      </template>
      <el-menu-item v-for="(menu) in item.children" :key="menu.path" :index="item.path+'/'+menu.path">{{menu.meta.title}}</el-menu-item>
    </el-submenu>
</div>
  </el-menu>
</template>

<script>
export default {
  computed: {
    computedPath() {
      return this.$route.path;
    }
  },
  data(){
    return {
      menuList:[]
    }
  },
  mounted(){
    this.menuList=this.$session.get("sell_menus");
    console.log(this.menuList)
  }
};
</script>

<style lang="less" scoped>
</style>